﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

class Animals
{
    static void Main()
    {
        Animal[] animals = 
        {
            new Cat("Pesho",4,true),
            new TomCat("Vanio",4),
            new Kitten("Penka",2),
            new Frog("Zlatka",4,false),
            new Dog("Tom",5,false),
            new Cat("Shisho",5,false),
            new TomCat("Canio",10),
            new Kitten("Lusi",3),
            new Frog("Kondio",6,true),
            new Dog("Kucho",2,true)
        };
        foreach (var item in animals)
        {
            item.showAvAge();
            item.whatIsAnimal(item.Sound);
        }
    }
}
class Animal
{
    private string name;
    private int age;
    private bool sex; // false = male, true=female
    private string sound;
    public string Sound
    {
        get { return sound; }
    }
    public Animal(string name, int age, bool sex, string sound)
    {
        this.name = name;
        this.age = age;
        this.sex = sex;
        this.sound = sound;
    }
    public virtual void showAvAge()
    {
        Console.WriteLine("Show avarage animal of animals");
    }
    public static void showName(string sd)
    {
        if (String.Compare(sd, "Bauuuu") == 0)
            Console.WriteLine("I'm a dog");
        else if (String.Compare(sd, "Quaak") == 0)
            Console.WriteLine("I'm a frog");
        else if (String.Compare(sd, "Mqaaal") == 0)
            Console.WriteLine("I'm a cat");
    }
    public void whatIsAnimal(string sd)
    {
        showName(sd);
    }
}
class Dog : Animal
{
    static double ageSum = 0;
    static double count = 0;
    public Dog(string name, int age, bool sex)
        : base(name, age, sex, "Bauuuu")
    {
        ageSum += age;
        count++;
    }
    public static double avAge()
    {
        return ageSum / count;
    }
    public override void showAvAge()
    {
        Console.WriteLine("Dogs avarage age is {0}", avAge());
    }
}
class Frog : Animal
{
    static double ageSum = 0;
    static double count = 0;
    public Frog(string name, int age, bool sex)
        : base(name, age, sex, "Quaak")
    {
        ageSum += age;
        count++;
    }
    public static double avAge()
    {
        return ageSum / count;
    }
    public override void showAvAge()
    {
        Console.WriteLine("Frog avarage age is {0}", avAge());
    }

}
class Cat : Animal
{
    static double ageSum = 0;
    static double count = 0;
    public Cat(string name, int age, bool sex)
        : base(name, age, sex, "Mqaaal")
    {
        ageSum += age;
        count++;
    }
    public static double avAge()
    {
        return ageSum / count;
    }
    public override void showAvAge()
    {
        Console.WriteLine("Cat avarage age is {0}", avAge());
    }
}
class Kitten : Cat
{
    static double ageSum = 0;
    static double count = 0;
    public Kitten(string name, int age)
        : base(name, age, true)
    {
        ageSum += age;
        count++;
    }
    public static double avAge()
    {
        return ageSum / count;
    }
    public override void showAvAge()
    {
        Console.WriteLine("Kitten avarage age is {0}", avAge());
    }
}
class TomCat : Cat
{
    static double ageSum = 0;
    static double count = 0;
    public TomCat(string name, int age)
        : base(name, age, false)
    {
        ageSum += age;
        count++;
    }
    public static double avAge()
    {
        return ageSum / count;
    }
    public override void showAvAge()
    {
        Console.WriteLine("TomCat avarage age is {0}", avAge());
    }
}

